﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<QLPKWeb.Models.FormBean.PhanQuyen.RolesForm>" %>

<%@ Import Namespace="Webdiyer.WebControls.Mvc" %>
<%@ Import Namespace="DONGACS.DTO" %>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <!-- include some files -->

    <script type="text/javascript" language="javascript" src="<%= ResolveUrl("~/Content/Scripts/Roles/Role.js") %>"></script>
    <script type="text/javascript">
        selectMenu("system-Roles");
    </script>
    <form name="RolesForm" action="" method="post">

   <%-- <div class="module">--%>
  <div class="box round first fullpage">
            <h4> Quản lý Nhóm quyền</h4>
		<!-- end box / title -->
        <%--<div class="module_top">
        </div>--%>
        <%--<div class="contain_module">--%>
            <!-- Role form -->
            <table class="table_outsite">
                <tr>
                    <td align="left">
                        <%--Thông Báo--%>
                        <%
                            if (Model.MessageCreateRoles != null)
                            {
                        %>
                        <div id="MessageCreateRoles" style="font-size: 12px; color: Blue; font-weight: bold">
                            <%=Model.MessageCreateRoles %></div>
                        <%
                            }
                        %>
                        <%
                            if (Model.MessageEditRoles != null)
                            {
                        %>
                        <div id="MessageEditRoles" style="font-size: 12px; color: Blue; font-weight: bold">
                            <%=Model.MessageEditRoles %></div>
                        <%
                            }
                        %>
                        <%--end--%>
                    </td>
                    
                </tr>
                 </table >
                <table class="table_input">
                <tr>
                    <td>
                        Mã Role:
                    </td>
                    <td colspan="3">
                        <input type="text" name="ID" id="ID" class="gray" readonly="readonly" value='<%=Model.ID %>' size="30" />
                        <%--<%=Html.TextBox("ID",Model.ID, new { @size = "24", @readonly = "true", @class = "gray" })%>
--%>
                        <%=Html.Hidden("IdHidden", Model.ID) %>
                    </td>
                </tr>
                <tr>
                    <td style="width: 18%">
                        Ngày tạo:
                    </td>
                    <td class="gray" style="width: 39%">
                        <%=Html.TextBox("CreateDate", Model.CreateDate.ToString("dd/MM/yyyy"), new { @size = "30", @readonly = "true", @class = "gray" })%>&nbsp;
                        <%=Html.Hidden("CreateDateHidden", Model.CreateDate.ToShortDateString())%>
                    </td>
                    <td width="16%">
                        <b>Tên Role:</b>
                    </td>
                    <td width="32%">
                        <%= Html.TextBox("RoleName", Model.RoleName, new { @size = "30", @onblur = "javascript:doOnBlurRoleName();" })%>
                        <div id="RoleNameMessage" style="color: Red;">
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        Ngày cập nhật:
                    </td>
                    <td class="gray">
                        <%=Html.TextBox("UpdateDate", Model.UpdateDate.ToString("dd/MM/yyyy"), new { @size = "30", @readonly = "true", @class = "gray" })%>&nbsp;
                        <%=Html.Hidden("UpdateDateHidden", Model.UpdateDate.ToShortDateString())%>
                    </td>
                    <td>
                        Mô tả :
                    </td>
                    <td>
                        <%=Html.TextBox("Description", Model.Description, new { @size = "30", @class = "gray" })%>&nbsp;
                    </td>
                </tr>
                <tr>
                    <td>
                        Người tạo:
                    </td>
                    <td class="gray">
                        <%=Html.TextBox("CreateBy", Model.CreateByUser, new { @size = "30", @readonly = "true", @class = "gray" })%>&nbsp;
                        <%=Html.Hidden("CreateByHidden", Model.CreateByUser)%>
                    </td>
                    <td>
                        Người cập nhật:
                    </td>
                    <td>
                        <%=Html.TextBox("UpdateBy", Model.UpdateByUser, new { @size = "30", @readonly = "true", @class = "gray" })%>&nbsp;
                        <%=Html.Hidden("UpdateByHidden", Model.UpdateByUser)%>
                    </td>
                </tr>
                <tr>
                    <td>
                        Kích hoạt :
                    </td>
                    <td>
                        <%=Html.CheckBox("IsEnable", Model.IsEnable)%>
                        <%=Html.Hidden("IsEnableHidden", Model.IsEnable)%>
                    </td>
                    <td>
                        <%--Is Deleted:--%>
                    </td>
                    <td>
                        &nbsp;
                        <%--<%=Html.CheckBox("IsDelete", Model.IsDelete)%>
                        <%=Html.Hidden("IsDeleteHidden", Model.IsDelete)%>--%>
                    </td>
                </tr>
                <tr>
                    <td align="right"style="padding-top:10px;" colspan="4">
                        <input type="button" class="btn btn-grey"value="Tạo/Cập nhật" onclick="javascript:DoCreateOrEdit();" />
                        <input type="button" class="btn btn-grey"value="Tạo mới" onclick="javascript:NewAjax();" />
                        <input type="button" class="btn btn-grey"value="Xóa" onclick='javascript:DeleteRole();' />
                        <input type="reset" class="btn btn-grey"value="Nhập lại" onclick="javascript:ResetRole();" />
                    </td>
                </tr>
            </table>
            
           
               
            <table class="table table-striped table-bordered dataTable">
               
                <tr>
                    <td colspan="3" class="first"  style="width: 100%">
                     Danh sách Roles  <span style="float: right"> <%=Html.TextBox("RoleNameSearch")%>
                         <img onclick="javascript:doSearch();" style="vertical-align: middle; cursor:pointer"  src="<%=ResolveUrl("~/Content/img/search_icon.gif")%>"
                            alt="Tìm theo tên role" title="Tìm theo tên role"/></span>
                    </td>
                </tr>
                <tr>
                    <td colspan="4">
                        <table border="0" cellspacing="0" cellpadding="0" class="table" id="example">
                            <tr class="title">
                                <td style="border: 1px solid #ddd;  "class="first" width="10%">
                                    &nbsp;<strong>Mã</strong>
                                </td>
                                <td style="border: 1px solid #ddd "nowrap="nowrap">
                                    &nbsp;<strong>Tên Role</strong>
                                </td>
                                <td style="border: 1px solid #ddd "nowrap="nowrap">
                                    &nbsp;<strong>Mô tả</strong>
                                </td>
                                <td style="border: 1px solid #ddd "nowrap="nowrap" align="center">
                                    <strong >Đang sử dụng</strong>
                                </td>
                                <td style="border: 1px solid #ddd "nowrap="nowrap" align="center">
                                    <strong>Permission</strong>
                                </td>
                                <td style="border: 1px solid #ddd "nowrap="nowrap">
                                    &nbsp;<strong>Ngày cập nhật</strong>
                                </td>
                                <td style="border: 1px solid #ddd "width="14%" class="last"  nowrap="nowrap">
                                    &nbsp;<strong>Người cập nhật</strong>
                                </td>
                            </tr>
                            <%
                                IList<RolesDto> dtos = Model.RolesPagedList;
                                foreach (RolesDto dto in dtos)
                                {%>
                            <tr class="item_row" onclick="highlight(this);EditAjax(<%=dto.ID %>);">
                                <td style="border: 1px solid #ddd "class="first">
                                    &nbsp;<%=dto.ID %>
                                </td>
                                <td style="border: 1px solid #ddd ">
                                    &nbsp;<%=dto.RoleName %>
                                </td>
                                <td style="border: 1px solid #ddd ">
                                    &nbsp;<%=dto.Description ?? string.Empty %>
                                </td>
                                <td style="text-align:center;border: 1px solid #ddd ">
                                    <%if (dto.IsUsed)
                                      {%>
                                    Yes
                                    <%}
                                      else
                                      {%>
                                    No
                                    <%}%>
                                </td>
                                <td style="text-align:center;border: 1px solid #ddd ">
                                    <%if (dto.HavePermission)
                                      {%>
                                    Yes
                                    <%}
                                      else
                                      {%>
                                    No
                                    <%}%>
                                </td>
                                <td style="border: 1px solid #ddd ">
                                    &nbsp;<%=dto.UpdateDate.ToShortDateString()%>
                                </td>
                                <td style="border: 1px solid #ddd " class="last" nowrap="nowrap">
                                    &nbsp;<%=dto.UpdateByUser%>
                                </td>
                            </tr>
                            <% } %>
                            <tr class="border_bottom">
                                <td class="first" style="background: #DDDDDD">
                                </td>
                                <td class="last" colspan="6" align="right" style="background: #DDDDDD; padding-right: 10px">
                                    <div>
                                        <%=Html.Pager(Model.RolesPagedList,new PagerOptions{PageIndexParameterName="id"}) %></div>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
            

    </div>
   <%-- </div>--%>
   
    </form>
</asp:Content>
